compute the correct totalram_pages when the balloon increase or decrease the
authorvhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Mon, 24 Oct 2005 11:57:37 +0000 (12:57 +0100)
committervhanquez@kneesa.uk.xensource.com <vhanquez@kneesa.uk.xensource.com>
Mon, 24 Oct 2005 11:57:37 +0000 (12:57 +0100)
reservation. memory reports should be more correct now.

From: Satoshi Uchida <s-uchida@ap.jp.nec.com>
Signed-off-by: Vincent Hanquez <vincent@xensource.com>
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c

index 14a9718326cf59c128bc37df344ce1c27d795651..f630d4bf712ce968853a20529c6f303805078a5f 100644 (file)
@@ -70,6 +70,9 @@ spinlock_t balloon_lock = SPIN_LOCK_UNLOCKED;
 static unsigned long current_pages;
 static unsigned long target_pages;
 
+/* VM /proc information for memory */
+extern unsigned long totalram_pages;
+
 /* We may hit the hard limit in Xen. If we do then we remember it. */
 static unsigned long hard_limit;
 
@@ -223,6 +226,7 @@ static int increase_reservation(unsigned long nr_pages)
        }
 
        current_pages += nr_pages;
+       totalram_pages = current_pages;
 
  out:
        balloon_unlock(flags);
@@ -295,6 +299,7 @@ static int decrease_reservation(unsigned long nr_pages)
                XENMEM_decrease_reservation, &reservation) != nr_pages);
 
        current_pages -= nr_pages;
+       totalram_pages = current_pages;
 
        balloon_unlock(flags);